using System;
using System.Collections.Generic;
using System.Text;

namespace Krile.Kernel
{
    //Bridge System
    public static class Bridge
    {

        private static Bridges.IMainForm mainform = null;
        /// <summary>
        /// Krile main form
        /// </summary>
        public static Bridges.IMainForm MainForm
        {
            get { return mainform; }
            set
            {
                if (mainform != null)
                    throw new FieldAccessException("Bridge.MainForm can't set.");
                mainform = value;
            }
        }

        private static Bridges.IPluginManager pluginmanager = null;
        /// <summary>
        /// Krile plugin manager
        /// </summary>
        public static Bridges.IPluginManager PluginManager
        {
            get { return pluginmanager; }
            set
            {
                if (pluginmanager != null)
                    throw new FieldAccessException("Bridge.PluginManager can't set.");
                pluginmanager = value;
            }
        }

        private static Bridges.IStatusManager statusmanager = null;        
        /// <summary>
        /// Krile status manager
        /// </summary>
        public static Bridges.IStatusManager StatusManager
        {
            get { return statusmanager; }
            set
            {
                if (statusmanager != null)
                    throw new FieldAccessException("Bridge.StatusManager can't set.");
                statusmanager = value;
            }
        }

        private static Bridges.IConfig config = null;
        /// <summary>
        /// Krile config
        /// </summary>
        public static Bridges.IConfig Config
        {
            get { return config; }
            set
            {
                if (config != null)
                    throw new FieldAccessException("Bridge.Config can't set.");
                config = value;
            }
        }

        private static Bridges.IDebugReporter debugreporter = null;
        /// <summary>
        /// Krile debug reporter
        /// </summary>
        public static Bridges.IDebugReporter DebugReporter
        {
            get { return debugreporter; }
            set
            {
                if (debugreporter != null)
                    throw new FieldAccessException("Bridge.DebugReporter can't set.");
                debugreporter = value;
            }
        }

        private static Bridges.IControlManager controlmanager = null;
        /// <summary>
        /// Krile control manager
        /// </summary>
        public static Bridges.IControlManager ControlManager
        {
            get { return controlmanager; }
            set
            {
                if (controlmanager != null)
                    throw new FieldAccessException("Bridge.ControlManager can't set.");
                controlmanager = value;
            }
        }

        private static Bridges.IImageManager imagemanager = null;
        /// <summary>
        /// Krile image manager
        /// </summary>
        public static Bridges.IImageManager ImageManager
        {
            get { return imagemanager; }
            set
            {
                if (imagemanager != null)
                    throw new FieldAccessException("Bridge.ImageManager can't set.");
                imagemanager = value;
            }
        }

        private static Bridges.ICommonOperation commonoperation = null;
        /// <summary>
        /// Krile common operation
        /// </summary>
        public static Bridges.ICommonOperation CommonOperation
        {
            get { return commonoperation; }
            set
            {
                if (commonoperation != null)
                    throw new FieldAccessException("Bridge.CommonOperation can't set.");
                commonoperation = value;
            }
        }

        private static Bridges.IKeyAssign keyassign = null;
        /// <summary>
        /// Krile key-assign
        /// </summary>
        public static Bridges.IKeyAssign KeyAssign
        {
            get { return keyassign; }
            set
            {
                if (keyassign != null)
                    throw new FieldAccessException("Bridge.KeyAssign can't set.");
                keyassign = value;
            }
        }

        private static Bridges.INotificationManager notificationmanager = null;
        public static Bridges.INotificationManager NotificationManager
        {
            get { return notificationmanager; }
            set
            {
                if (notificationmanager != null)
                    throw new FieldAccessException("Bridge.NotificationManager can't set.");
                notificationmanager = value;
            }
        }
    }
}
